﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CookComputing.XmlRpc;

namespace JeanFish.Blog.XmlRpc
{
    /// <summary>
    /// Defines the MetaWeblog API.
    /// </summary>
    public interface IMetaWeblog
    {
        /// <summary>
        /// Edits the post。
        /// </summary>
        /// <param name="postid">The ID of Post.</param>
        /// <param name="username">The username of Blog.</param>
        /// <param name="password">The password of Blog.</param>
        /// <param name="post">The post to edit.</param>
        /// <param name="publish">A boolean value indicating whither the post should be published after editing.</param>
        /// <returns>The result to editing the post.</returns>
        [XmlRpcMethod("metaWeblog.editPost", Description = "Edits the post.")]
        Task<bool> EditPostAsync(string postid, string username, string password, Post post, bool publish);
        /// <summary>
        /// 获取分类列表。
        /// </summary>
        /// <param name="blogid">博客编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <returns>分类列表</returns>
        [XmlRpcMethod("metaWeblog.getCategories", Description = "获取分类。")]
        CategoryInfo[] GetCategories(string blogid, string username, string password);
        /// <summary>
        /// 获取博文。
        /// </summary>
        /// <param name="postid">博文编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <returns>博文信息</returns>
        [XmlRpcMethod("metaWeblog.getPost",Description = "获取博文。")]
        Post GetPost(string postid, string username, string password);
        /// <summary>
        /// 获取最近发表的博文列表。
        /// </summary>
        /// <param name="blogid">博客编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="numberOfPosts">博文数量</param>
        /// <returns>最近发表的博文列表</returns>
        [XmlRpcMethod("metaWeblog.getRecentPosts",Description = "获取最近发表的博文。")]
        Post[] GetRecentPosts(string blogid, string username, string password, int numberOfPosts);
        /// <summary>
        /// 新建博文。
        /// </summary>
        /// <param name="blogid">博客编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="post">博文信息</param>
        /// <param name="publish">是否发表</param>
        /// <returns>新建博文结果</returns>
        [XmlRpcMethod("metaWeblog.newPost",Description = "新建博文。")]
        string NewPost(string blogid, string username, string password, Post post, bool publish);
        /// <summary>
        /// 新建多媒体对象。
        /// </summary>
        /// <param name="blogid">博客编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="file">多媒体文件信息</param>
        /// <returns>多媒体地址</returns>
        [XmlRpcMethod("metaWeblog.newMediaObject",Description = "新建多媒体对象。")]
        UrlData NewMediaObject(string blogid, string username, string password, FileData file);
    }
}
